package com.yanqu.road.server.cmd.activity.biaoju;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.BiaoJuProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.biaoju.CrossBiaoJuActivity;
import com.yanqu.road.server.manager.activity.biaoju.CrossBiaoJuMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Protocol.C_BIAOJU_SET_CAN_BE_PULL_QUALITY, desc = "设置可以被拉进队的镖单品质")
public class CrossBiaoJuSetCanBePullQualityCmd extends CrossUnionCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        BiaoJuProto.BiaoJuSetCanBePullQualityReqMsg reqMsg = BiaoJuProto.BiaoJuSetCanBePullQualityReqMsg.parseFrom(packet.getBytes());
        CrossBiaoJuActivity activity = CrossBiaoJuMgr.getActivity(reqMsg.getActivityId(), groupId);
        if (activity == null) {
            return;
        }
        BiaoJuProto.BiaoJuSetCanBePullQualityRespMsg.Builder respMsg = activity.setCanBePullQuality(packet.getPlayerId(), reqMsg.getQualityList(), reqMsg.getCanBePullIdList(), reqMsg.getQualitySwitch());
        MessageHelper.sendPacket(serverId, packet.getPlayerId(),
                YanQuMessageUtils.buildMessage(ClientProtocol.U_BIAOJU_SET_CAN_BE_PULL_QUALITY, respMsg));
    }

    @Override
    public void sendData() {

    }
}
